#打开文件
list = [
    "今天是个好日子",
    "明天也是个好日子",
    "后天也是个好日子",
    "大家好，中国！"  
]

    
#使用with可以保证文件的关闭   
with open("c.txt","w",encoding="utf-8") as f: 
        
    list = "\n".join(list)  #推导式list = [ele + "\n" for ele in list]
    f.writelines(list)

print(f.closed)
